#ifndef _SSL_H
#define _SSL_H

struct ssl_st;
struct ssl_method_st;
struct ssl_ctx_st;

class SSL
{
public:
  SSL();
  ~SSL();

  void SetSocket(int socket);
  int Read(char* buf, int len);
  int Write(const char* buf, int len);

protected:
  ssl_st* st;
  ssl_ctx_st* context;

  static void (*SSL_free)(ssl_st*);
  static int (*SSL_accept)(ssl_st*);
  static int (*SSL_connect)(ssl_st*);
  static int (*SSL_read)(ssl_st*, void *, int);
  static int (*SSL_write)(ssl_st*, const void *, int);
  static int (*SSL_get_error)(ssl_st*, int);
  static int (*SSL_set_fd)(ssl_st*, int);
  static ssl_st* (*SSL_new)(ssl_ctx_st*);
  static ssl_ctx_st* (*SSL_CTX_new)(ssl_method_st*);
  static ssl_method_st* (*SSLv23_server_method)();
  static int* (*SSL_library_init)();
  static int (*SSL_CTX_use_certificate_file)(ssl_ctx_st*, const char *, int);
  static int (*SSL_CTX_use_PrivateKey_file)(ssl_ctx_st*, const char *, int);
  static void (*SSL_CTX_free)(ssl_ctx_st*);
  static const char* (*SSL_get_cipher_list)(const ssl_st* ssl, int priority);

  static int (*CRYPTO_num_locks)();
  static void (*CRYPTO_set_locking_callback)(void (*)(int, int, const char *, int));
  static void (*CRYPTO_set_id_callback)(unsigned long (*)(void));
};

#endif//_SSL_H
